package com.zone.gateway.core.socket.agreement;

/**
 * @author: zongzi
 * @description: 网关处理结果包装类
 * @date: 2025/4/23
 */
public class GatewayResultMessage {

    private final String code;
    private final String info;
    private final Object data;

    public GatewayResultMessage(String code, String info, Object data) {
        this.code = code;
        this.info = info;
        this.data = data;
    }

    public static GatewayResultMessage success() {
        return success(null);
    }

    public static GatewayResultMessage success(Object data) {
        return new GatewayResultMessage(AgreementConstant.ResponseCode._200.getCode(), AgreementConstant.ResponseCode._200.getInfo(), data);
    }

    public static GatewayResultMessage newInstant(AgreementConstant.ResponseCode responseCode) {
        return newInstant(responseCode, null);
    }

    public static GatewayResultMessage newInstant(AgreementConstant.ResponseCode responseCode, Object data) {
        return new GatewayResultMessage(responseCode.getCode(), responseCode.getInfo(), data);
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public Object getData() {
        return data;
    }
}
